<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Chat extends Model
{
    //
    use SoftDeletes;
    protected $table = 'chat';
    protected $primarykey = 'id';
    //设置日期时间格式
    public $dateFormat = 'U';
    public $timestamps = false;
    protected $dates = ['deleted_at'];

    public function user()
    {
        return $this->belongsTo('App\Models\User');
    }
    public function room()
    {
        return $this->belongsTo('App\Models\Room');
    }
    public function users()
    {
        return $this->belongsToMany('App\Models\User','user_room','room_id','user_id','room_id','id');
    }
}
